dnl -*-Mode: C; comment-start: "dnl "-*-
dnl Process this file with autoconf to produce a configure script.
AC_REVISION([configure.in,v 1.2 1998/10/03 00:17:50 jmacd Exp])dnl
AC_INIT(xdelta.c)
AM_CONFIG_HEADER(config.h)

dnl $Format: "AM_INIT_AUTOMAKE(xdelta, $ReleaseVersion$, no-define)" $
AM_INIT_AUTOMAKE(xdelta, 1.1.4, no-define)

AM_MAINTAINER_MODE

DEBUGFLAG=
PROFILEFLAG=

AC_ARG_ENABLE(debug, [  --enable-debug          turn on debugging [default=no]])
AC_ARG_ENABLE(profile, [  --enable-profile        turn on profiling [default=no]])

TMPCFLAGS="$CFLAGS"
CFLAGS=

AC_PROG_CC
AC_PROG_CPP

CFLAGS=$TMPCFLAGS

changequote(,)dnl
if test "x$GCC" = "xyes"; then
  case " $CFLAGS " in
  *[\ \	]-Wall[\ \	]*) ;;
  *) CFLAGS="$CFLAGS -Wall" ;;
  esac

  if test "x$enable_debug" = "xyes"; then
    DEBUGFLAG="-g"
  fi

  if test "x$enable_profile" = "xyes"; then
    PROFILEFLAG="-pg"
  fi

  if test -n "$DEBUGFLAG"; then
    case " $CFLAGS " in
    *[\ \	]$DEBUGFLAG[\ \	]*) ;;
    *) CFLAGS="$DEBUGFLAG $CFLAGS" ;;
    esac
  else
    case " $CFLAGS " in
    *[\ \	]-O[0-9\ \	]*) ;;
    *) CFLAGS="$CFLAGS -O3" ;;
    esac
  fi

  if test -n "$PROFILEFLAG"; then
    case " $CFLAGS " in
    *[\ \	]$PROFILEFLAG[\ \	]*) ;;
    *) CFLAGS="$PROFILEFLAG $CFLAGS" ;;
    esac
  fi
fi
changequote([,])dnl

AM_PROG_LIBTOOL
AC_HEADER_STDC
AC_PROG_MAKE_SET

AC_CHECK_FUNCS(gettimeofday)
AC_HEADER_TIME

AC_PATH_PROGS(EMACS, emacs xemacs, emacs)

top_srcdir_absolute=`cd $srcdir; pwd`
AC_SUBST(top_srcdir_absolute)

AM_PATH_GLIB(1.2.8,,
  AC_MSG_ERROR(Test for GLIB failed. Download it from ftp://ftp.gtk.org/pub/gtk/v1.2/))

dnl AC_CHECK_LIB(z, gzsetparams, */
dnl   AC_CHECK_HEADER(zlib.h,, */
dnl     AC_MSG_ERROR(ZLIB headers not found)), */
dnl   AC_MSG_ERROR(ZLIB library not found)) */

AC_OUTPUT(Makefile
	  doc/Makefile
          test/Makefile
          djgpp/Makefile
	  xdelta-config
	  libedsio/Makefile
	  libedsio/edsio-comp,

	  chmod +x libedsio/edsio-comp xdelta-config
	  )
